app.controller('userInfoCtr',["$rootScope","$scope",'$state',"userInfoCacheFactory","confirmFactory","userInfoService", function($rootScope,$scope,$state,userInfoCacheFactory,confirmFactory,userInfoService) {
    $scope.orderNum = {};
    $scope.navTab = userInfoCacheFactory.navTab;
    $scope.orderStateData = userInfoCacheFactory.orderState;

    $scope.navTabClick = function(id){
        if(id === 2 && !$rootScope.userInfoData.level){
            confirmFactory({
                text:'您还不是分销会员,立刻升级为成销会员？',
                option:{
                    go:function(){
                        location.href = $rootScope.prefix + 'help/helpDetail.html?id=vipDistributors';
                    }
                }
            });
            return;
        }
        if(id === 3){
            $state.transitionTo("userInfo/orderlist");
        }
        $scope.navTabSelectId = id;
    };

    userInfoService.orderNum(function(data){
        $scope.orderNum = data.data;
    });
    $scope.navTabClick($scope.navTab[0].id);
}]);
